//
//  AvatarView.m
//  NuwaRobot
//
//  Created by Kendama on 2017/11/30.
//  Copyright © 2017年 Kendama. All rights reserved.
//

#import "AvatarView.h"

@implementation AvatarView

- (UIImageView *)avatarImageView
{
    if(!_avatarImageView)
    {
        UIView *superView = self;
        _avatarImageView = [[UIImageView alloc]init];
        [superView addSubview:_avatarImageView];
        _avatarImageView.layer.cornerRadius = px1920Height(250)/2;
        _avatarImageView.layer.masksToBounds = YES;
//        _avatarImageView.image = [UIImage imageNamed:@"head1"];
    }
    return _avatarImageView;
}
- (UILabel *)nicknameLabel
{
    if(!_nicknameLabel)
    {
        UIView *superView = self;
        _nicknameLabel = [[UILabel alloc]init];
        [superView addSubview:_nicknameLabel];
        [_nicknameLabel setFont:fontCommonSize];
        [_nicknameLabel setTextColor:[UIColor whiteColor]];
        _nicknameLabel.textAlignment = NSTextAlignmentCenter;
        _nicknameLabel.text = @"笨笨熊";
    }
    return _nicknameLabel;
}



- (void)masLayoutSubview
{
    __weak UIView *superView = self;
    
    [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.centerX.mas_equalTo(superView);
        make.width.height.mas_equalTo(px1920Height(250));
    }];
    
    [self.nicknameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.avatarImageView.mas_bottom);
        make.centerX.mas_equalTo(self.avatarImageView.mas_centerX);
        make.height.mas_equalTo(px1920Height(100));
    }];
    
}

@end
